import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import axios from 'axios'
//导入字体图标
import 'assets/fonts/iconfont.css'
//导入全局样式表
import 'assets/css/global.css'

//导入TreeTable 插件 用于商品分类列表
import TreeTbale from 'vue-table-with-tree-grid'

//注册富文本编辑器组件
import VueQuillEditor from 'vue-quill-editor'

import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme

//导入进度条组件的css
import 'nprogress/nprogress.css'

Vue.config.productionTip = false
//全局注册TreeTable 插件
Vue.component('tree-table',TreeTbale)

//注册一个全局过滤器，用来转换日期
//dateFormat是过滤器名称
Vue.filter('dateFormat', function(originVal) {
  const dt = new Date(originVal * 1000)
  const y = dt.getFullYear()
  const m = (dt.getMonth() + 1 + '').padStart(2, '0')
  const d = (dt.getDate() + '').padStart(2, '0')

  const hh = (dt.getHours() + '').padStart(2, '0')
  const mm = (dt.getMinutes() + '').padStart(2, '0')
  const ss = (dt.getSeconds() + '').padStart(2, '0')
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})


//将富文本编辑器注册全局可用的组件
Vue.use(VueQuillEditor)

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
